﻿using Bentley.DgnPlatformNET.Elements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 圆管涵正管节;

namespace PrefabricateNomalSlabCulvert4m.uitl.refSoiled
{
    internal class BodyTexture
    {
        //赋予八字墙图层和材质
        public static void AddAliformLevelTexture(Element aliformElement, string solidName)
        {
            if (aliformElement == null)
                return;
            //ini文件中对应的名字
            switch (solidName)
            {
                case "盖板涵":
                    solidName = "SlabCulvertData";
                    break;
                case "箱涵":
                    solidName = "BoxCulvertData";
                    break;
                case "圆管涵":
                    solidName = "SlabCulvertData";
                    break;
                default:
                    break;
            }
            //获取ini文件层名
            string[] ParametersTi = { solidName, "Aliform", "Layer" };
            string levelName = SolidHelper.GetINIvalue(ParametersTi, "");
            //元素添加图层
            SolidHelper.setElementByLevel(levelName, (int)SolidColor.灰色, (int)SolidLineStyle.连续线, 0, aliformElement);
            //获取材质
            string[] ParametersTi1 = { solidName, "Aliform", "Texture" };
            string textureName = SolidHelper.GetINIvalue(ParametersTi1, "");
            DisplayableElement displayEle = aliformElement as DisplayableElement;
            //添加材质
            SolidHelper.ElementAttachMaterial(displayEle, textureName);
        }


        //public static void AddBasicsLevelTexture(Element Element, string solidName)
        //{
        //    if (Element == null)
        //        return;
        //    switch (solidName)
        //    {
        //        case "盖板涵":
        //            solidName = "SlabCulvertData";
        //            break;
        //        case "箱涵":
        //            solidName = "BoxCulvertData";
        //            break;
        //        case "圆管涵":
        //            solidName = "SlabCulvertData";
        //            break;
        //        default:
        //            break;
        //    }
        //    //获取ini文件层名
        //    string[] ParametersTi = { solidName, "Basis", "Layer" };
        //    string levelName = SolidHelper.GetINIvalue(ParametersTi, "");
        //    //元素添加图层
        //    SolidHelper.setElementByLevel(levelName, (int)SolidColor.灰色, (int)SolidLineStyle.连续线, 0, Element);
        //    //获取材质
        //    string[] ParametersTi1 = { solidName, "Basis", "Texture" };
        //    string textureName = SolidHelper.GetINIvalue(ParametersTi1, "");
        //    DisplayableElement displayEle = Element as DisplayableElement;
        //    //添加材质
        //    SolidHelper.ElementAttachMaterial(displayEle, textureName);
        //}
        //赋予铺砌或者截水墙图层和材质
        public static void AddPaveAndCutoffWallLevelTexture(Element Element, string solidName)
        {
            if (Element == null)
                return;
            switch (solidName)
            {
                case "盖板涵":
                    solidName = "SlabCulvertData";
                    break;
                case "箱涵":
                    solidName = "BoxCulvertData";
                    break;
                case "圆管涵":
                    solidName = "SlabCulvertData";
                    break;
                default:
                    break;
            }
            //获取ini文件层名
            string[] ParametersTi = { solidName, "Laid", "Layer" };
            string levelName = SolidHelper.GetINIvalue(ParametersTi, "");
            //元素添加图层
            SolidHelper.setElementByLevel(levelName, (int)SolidColor.灰色, (int)SolidLineStyle.连续线, 0, Element);
            //获取材质
            string[] ParametersTi1 = { solidName, "Laid", "Texture" };
            string textureName = SolidHelper.GetINIvalue(ParametersTi1, "");
            DisplayableElement displayEle = Element as DisplayableElement;
            //添加材质
            SolidHelper.ElementAttachMaterial(displayEle, textureName);
        }
        //赋予八字墙基础图层和材质
        public static void AddBasicsLevelTexture(Element Element, string solidName)
        {
            if (Element == null)
                return;
            switch (solidName)
            {
                case "盖板涵":
                    solidName = "SlabCulvertData";
                    break;
                case "箱涵":
                    solidName = "BoxCulvertData";
                    break;
                case "圆管涵":
                    solidName = "SlabCulvertData";
                    break;
                default:
                    break;
            }
            //获取ini文件层名
            string[] ParametersTi = { solidName, "Basis", "Layer" };
            string levelName = SolidHelper.GetINIvalue(ParametersTi, "");
            //元素添加图层
            SolidHelper.setElementByLevel(levelName, (int)SolidColor.灰色, (int)SolidLineStyle.连续线, 0, Element);
            //获取材质
            string[] ParametersTi1 = { solidName, "Basis", "Texture" };
            string textureName = SolidHelper.GetINIvalue(ParametersTi1, "");
            DisplayableElement displayEle = Element as DisplayableElement;
            //添加材质
            SolidHelper.ElementAttachMaterial(displayEle, textureName);
        }
    }
}
